﻿using Avalonia;
using System;
using System.Collections.Generic;
using Xilium.CefGlue;
using Xilium.CefGlue.Common;
using Xilium.CefGlue.Common.Shared;

namespace Ava.Web
{
    internal sealed class Program
    {
        // Initialization code. Don't use any Avalonia, third-party APIs or any
        // SynchronizationContext-reliant code before AppMain is called: things aren't initialized
        // yet and stuff might break.
        [STAThread]
        public static void Main(string[] args) => BuildAvaloniaApp()
            .StartWithClassicDesktopLifetime(args);

        // Avalonia configuration, don't remove; also used by visual designer.
        public static AppBuilder BuildAvaloniaApp()
            => AppBuilder.Configure<App>()
                .UsePlatformDetect()
                .WithInterFont()
                .LogToTrace()
          .AfterSetup(_ => CefRuntimeLoader.Initialize(new CefSettings()
          {
#if WINDOWLESS
                          WindowlessRenderingEnabled = true
#else
              WindowlessRenderingEnabled = false
#endif
          },
                      flags: new[] { new KeyValuePair<string, string>("disable-features", "NetworkService,VizDisplayCompositor") },
                      customSchemes: new[] {
                        new CustomScheme()
                        {
                            SchemeName = "test",
                            SchemeHandlerFactory = new CustomSchemeHandler()
                        }
                      }));
    }
}
